package com.kevinwu.sqlSession;

import com.kevinwu.pojo.Configuation;
import com.kevinwu.pojo.MappedStatement;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;
import java.util.Objects;

public interface Executor {

    /**
     * 执行数据库查询
     * @param configuation
     * @param mappedStatement
     * @param params
     * @param <E>
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     * @throws NoSuchFieldException
     * @throws IllegalAccessException
     * @throws IntrospectionException
     * @throws InvocationTargetException
     * @throws InstantiationException
     */
    public <E> List<E> query(Configuation configuation, MappedStatement mappedStatement, Object... params) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException, IntrospectionException, InvocationTargetException, InstantiationException;

    /**
     * 新增修改
     * @param configuation
     * @param mappedStatement
     * @param params
     * @throws SQLException
     * @throws ClassNotFoundException
     * @throws NoSuchFieldException
     * @throws IllegalAccessException
     */
    public  void executeTest(Configuation configuation, MappedStatement mappedStatement, Object... params) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException;

    /**
     * 删除
     * @param configuation
     * @param mappedStatement
     * @param params
     * @throws SQLException
     * @throws ClassNotFoundException
     * @throws NoSuchFieldException
     * @throws IllegalAccessException
     */
    public  void deleteTest(Configuation configuation, MappedStatement mappedStatement, Object... params) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException;

}
